package com.linux.huhx.socket;

import java.io.DataOutputStream;
import java.net.Socket;
import java.util.Random;

/**
 * Created by huhx on 2017-06-29.
 */
public class MulitpleThread implements Runnable {
    private Socket socket;

    MulitpleThread(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        try {
            DataOutputStream out = new DataOutputStream(socket.getOutputStream());
            out.writeBytes("L。 " + new Random().nextInt(10));
            socket.close(); // 这个是需要的，要不然客户端没有得到数据。
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
